package cn.iocoder.yudao.framework.common.enums;

import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
/**
 * @author FFFF
 */

@Getter
@AllArgsConstructor
public enum TradeModuleType implements ArrayValuable<Integer> {

    MALL(0, "商城"),
    METAL(1, "料商")
    ;

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(TradeModuleType::getType).toArray(Integer[]::new);


    private final Integer type;

    private final String name;

    @Override
    public Integer[] array() {
        return ARRAYS;
    }

    public static TradeModuleType valueOf(Integer type) {
        return ArrayUtil.firstMatch(item -> item.getType().equals(type), TradeModuleType.values());
    }
}
